package com.base.common.http.model;

import com.base.common.http.constant.SocketConstant;

import java.io.Serializable;

/**
 * HTML 配置模型类
 * @ClassName HttpConfigModel
 * @Description: HTML 配置模型类
 * @Author cheng
 * @Date 2020/6/3
 * @Version V1.0
 **/
public class HttpConfigModel implements Serializable {
    private String homeDir; //服务器映射的根目录 如 /home/webapp

    private String defaultFile;//默认Http 首页文件。如：index.html / home.html

    private String errFile; //当发送500错误请求时显示的html。如：500.html

    private String notFoundFile;    //当找不到文件内容时显示的HTML。 如： 404.html

    private int httpPort = SocketConstant.HTTP_PORT;

    private int socketPort = SocketConstant.SOCKET_PORT;

    public HttpConfigModel(String homeDir) {
        this.homeDir = homeDir;
    }

    public HttpConfigModel(String homeDir, String defaultFile, String errFile, String notFoundFile) {
        this.homeDir = homeDir;
        this.defaultFile = defaultFile;
        this.errFile = errFile;
        this.notFoundFile = notFoundFile;
    }

    public int getHttpPort() {
        return httpPort;
    }

    public void setHttpPort(int httpPort) {
        this.httpPort = httpPort;
    }

    public int getSocketPort() {
        return socketPort;
    }

    public void setSocketPort(int socketPort) {
        this.socketPort = socketPort;
    }

    public String getHomeDir() {
        return homeDir;
    }

    public void setHomeDir(String homeDir) {
        this.homeDir = homeDir;
    }

    public String getDefaultFile() {
        return defaultFile;
    }

    public void setDefaultFile(String defaultFile) {
        this.defaultFile = defaultFile;
    }

    public String getErrFile() {
        return errFile;
    }

    public void setErrFile(String errFile) {
        this.errFile = errFile;
    }

    public String getNotFoundFile() {
        return notFoundFile;
    }

    public void setNotFoundFile(String notFoundFile) {
        this.notFoundFile = notFoundFile;
    }

    public static final int HTTP_STATUS_500 = 500;

    public static final int HTTP_STATUS_404 = 404;

    public static final int HTTP_STATUS_200 = 200;
    /**
     * 未配置首页时的默认输出
     * 中文：当前站点未配置默认首页，请配置自定义首页
     */
    public static final String UN_HOME_FILE_RESPONSE = "<h3 style='color:red;'>The default home page is not configured for the current site. Please configure a custom home page</h3>";
    /**
     * 未配置500错误页面时的默认输出
     * 中文：系统发生500错误。请为当前站点配置默认错误页面。
     */
    public static final String UN_ERR_FILE_RESPONSE = "<h3 style='color:red;'>A 500 error occurred in the system. Please configure the default error page for the current site.</h3>";
    /**
     * 未配置404错误页面时的默认输出
     * 中文：系统发生404错误.找不到指定的文件或内容。请为当前站点配置默认404页面。
     */
    public static final String UN_NOT_FOUND_FILE_RESPONSE = "<h3 style='color:red;'>System Error 404. The specified file or content could not be found. Please configure the default 404 page for the current site.</h3>";

}
